package com.bacel.nb.product.core.domain;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Collection;

/**
 * Created by Administrator on 2017/8/30 0030.
 */
@Entity
public class Deviceowner {
    private Integer id;
    private String name;
    private String tel;
    private String location;
    private String contact;
    private Timestamp createdate;
    private Integer sysroleid;
    private Sysrole SysroleBySysroleid;

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name", nullable = true, length = 255)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "tel", nullable = true, length = 50)
    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    @Basic
    @Column(name = "location", nullable = true, length = 255)
    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @Basic
    @Column(name = "contact", nullable = true, length = 255)
    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }

    @Basic
    @Column(name = "createdate", nullable = true)
    public Timestamp getCreatedate() {
        return createdate;
    }

    public void setCreatedate(Timestamp createdate) {
        this.createdate = createdate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Deviceowner that = (Deviceowner) o;

        if (id != that.id) return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (tel != null ? !tel.equals(that.tel) : that.tel != null) return false;
        if (location != null ? !location.equals(that.location) : that.location != null) return false;
        if (contact != null ? !contact.equals(that.contact) : that.contact != null) return false;
        if (createdate != null ? !createdate.equals(that.createdate) : that.createdate != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (tel != null ? tel.hashCode() : 0);
        result = 31 * result + (location != null ? location.hashCode() : 0);
        result = 31 * result + (contact != null ? contact.hashCode() : 0);
        result = 31 * result + (createdate != null ? createdate.hashCode() : 0);
        return result;
    }
    @Column(name = "roleid",insertable = false,updatable = false)
    public Integer getSysroleid() {
        return sysroleid;
    }

    public void setSysroleid(Integer sysroleid) {
        this.sysroleid = sysroleid;
    }
    @ManyToOne
    @JoinColumn(name = "roleid", referencedColumnName = "id", foreignKey = @ForeignKey(name = "deviceowner_ibfk_1"))
    public Sysrole getSysroleBySysroleid() {
        return SysroleBySysroleid;
    }

    public void setSysroleBySysroleid(Sysrole sysroleBySysroleid) {
        SysroleBySysroleid = sysroleBySysroleid;
    }
}
